package com.scope.imageFilters;

import org.opencv.core.Mat;
import org.opencv.imgproc.Imgproc;

import android.content.Context;

public class Threshold extends BaseFilter<ThreshParam> {
    public Threshold(Context context) {
        super(context);
        mName = getFilterName();
    }

    public static String getFilterName() {
        return "Threshold";
    }
    
    @Override
    protected void applyFilter() {
        mFilteredImageMat = MatZeros();
        Mat temp = MatZeros();
        Imgproc.cvtColor(mSourceImageMat, temp, Imgproc.COLOR_RGB2GRAY);
        Imgproc.threshold(
        		temp,
        		mFilteredImageMat,
        		mParam.getThreshValue(),
        		mParam.getMaxValue(),
        		mParam.getTreshType().getValue() | Imgproc.THRESH_OTSU
        );
    }
}
